type Customer = {
  birthday?: Date;
};

function getCustomer(id: number): Customer | null | undefined {
  return id === 0 ? null : { birthday: new Date() };
}

let customer = getCustomer(0)
// 进行安全性检查
// if(customer !== null && customer !== undefined)
//     console.log(customer.birthday)

console.log(customer?.birthday?.getFullYear())

